
#include "cn/cnrt.h"

#include <iostream>

int main(int argc, char **argv)
{

    cnrtRet_t ret;
    int major;
    int minor;
    int patch;
    // ret = cnrtGetLibVersion(&major, &minor, &patch);
    // if (ret != cnrtSuccess) {
    //     std::cerr << "########cnrtGetLibVersion failed: " << ret << std::endl;
    //     return 1;
    // }
    // std::cout << "########################cnrtGetLibVersion: " << major << "." << minor << "." << patch << std::endl;


    ret = cnrtInit(0);
    if (ret != cnrtSuccess) {
        std::cerr << "########cnrtInit failed: " << ret << std::endl;
        return 1;
    }

    // // 获取device数量
    unsigned int deviceCount = 0;
    ret = cnrtGetDeviceCount(&deviceCount);
    if (ret != cnrtSuccess) {
        std::cerr << "########cnrtGetDeviceCount failed: " << ret << std::endl;
        return 1;
    }
    std::cout << "ret: " << ret <<   "   deviceCount: " << deviceCount << std::endl;

    cnrtDestroy();
    return 0;
}